<?php
/**
 * @author		Alexander Snitko
 * @author mail	a.lottis@gmail.com
 */
defined('_JEXEC') or die('Restricted access');
//$c_name=($this->data);
//foreach ($c_name  as $val){ $val;}
//$val = $c_name[0];

$user =& JFactory::getUser();
if($user->guest == 0) $kabinet = "private";
else $kabinet = "public";
z
?>
<ul class="statement_block container-prv">
<!--noindex--><a href="./<?=$kabinet;?>?view=catalog" rel="nofollow">&lt;&lt;&nbsp;назад к списку компаний</a><!--/noindex-->

<TABLE>
	<tr>
		<td colspan="4">
			<h1 class="display_inline_block"><?=$this->data->company_full_name;?></h1>
        
         <? if (@$this->admin[0]->user_id) { ?>
            <br><a class="blog_company right display_inline_block" href="/personalnyj-blog/?id=<?=$this->admin[0]->user_id;?>">Блог компании</a>
         <? } ?>
         <!--<pre><?// print_r($this->admin); ?></pre>-->
		</td>
	</tr>
	
	<tr>
		<td rowspan="4" id="company_logo" class="col1">
			<div>
            <img src="/media/company/logo_<?
                     if      ( file_exists('media/company/logo_'. @$this->data->company_id .'.jpg') ) {
                        echo $this->data->company_id .".jpg"; }
                     else if ( file_exists('media/company/logo_'. @$this->data->company_id .'.gif') ) {
                        echo $this->data->company_id .".gif"; }
                     else if ( file_exists('media/company/logo_'. @$this->data->company_id .'.png') ) {
                        echo $this->data->company_id .".png"; }
                     else
                        echo "0.png";
                  ?>" style="max-width:250px;max-height:150px;margin: 0;position: absolute;" />
         </div>
		</td>
		<td class="col1"><!--Рейтинг &nbsp;&nbsp;&nbsp;Среднее:  &nbsp;&nbsp; Отзывов: &nbsp;&nbsp;-->
			<div id="rating_1" style="height: 50px;">
                <input type="hidden" class="val" value="<?=$this->data->rang;?>"/>
				<input type="hidden" class="vote-id" value="<?=$this->data->company_id;?>"/>
        		<input type="hidden" class="votes" value="<?=$this->data->rang_num;?>"/>
			</div>
		</td>
	</tr>

	<tr>
       <td class="col1">
			<?='Лет на рынке: 12<br>';?>
	   </td>
	</tr>
	<tr>
       <td class="col1">
			Веб-сайт: <a href="http://<?=$this->data->site;?>" target="_blank"><?=$this->data->site;?></a><br>
	   </td>
	</tr>
	<tr>
       <td class="col1">
			E-mail: <a href="mailto:<?=$this->data->mail;?>"><?=$this->data->mail?></a><br>
	   </td>
	</tr>
	<tr>
       <td class="">
		<!--	<a href="#">Новости компании</a><br><?=@$this->data->news;?> ????? -->
	   </td>
	   <td class="col1 col3">
			<b>Адрес:</b> <?=$this->data->adress;?><br>
	   </td>
	</tr>
	<tr>
       <td>
			<span class="small"><?="Нашли ошибку &mdash; нажмите ";?></span><span class="small orange">Ctrl+ENTER?</span>
	   </td>
	   <td class="col1">
			Телефон.: <b><?=$this->data->tel;?></b><br>
	   </td>
	</tr>
	<!-- вид деятельности компании - полное описание -->
	<tr>
		<td colspan="2" class="notop container col3">
            <b>Описание компании:</b> <?=$this->data->desc;?><br>
		</td>
    </tr>
	<tr class="notop container">
		<td colspan="2" class="col3">
           <b>Услуги:</b><br>
		   <?php
		     foreach ($this->serv AS $s) {
			    echo $s->name . "<br>";
			 }
		   ?><br>
		</td>
    </tr>
	
	<!-- филиалы компании - полное описание -->
	<tr>
	    <td class="col3">
			<span>Количество филиалов: <?=count($this->filial);?> </span> 
		</td>
		<td class="col3">
			<?php
				   if (count($this->filial)) {
			?>
			<select onChange="ShowFilial(this);">
			    
				<option value=0 >Выберите филиал</option>
				<?php
				   foreach ($this->filial AS $f) {
				      echo "<option value=\"$f->company_id\">$f->company_name</option>";
				   }
				?>
			</select>
		    <? } ?>&nbsp;
		</td>
		
	</tr>
	<tr>
		<td colspan="3" class="notop container col3" id="filialInfo">
			...
		</td>
	</tr>
	
	
	<!-- образцы документов - прикрепляемые документы doc, pdf, xls -->
	<tr>
		<td colspan="3" class="notop container">
			<p>Образцы документов</p>
			<ul class="doc_list">
			<? foreach ($this->docs AS $d) { ?>
            <li><a href="<?=( ($d->file) ? "/images/company/".$d->company_id."/".$d->file : $d->href );?>" target="_blank"><?=$d->name;?></a></li>
			<? } ?>
			</ul>
		</td>
	</tr>
    

	<!-- отзывы посетителей -->
	<tr>
		<td colspan="3" class="">
			<p>Отзывы посетителей <a href="#" class="add_comment right display_inline_block">Написать отзыв</a></p> 
		</td>
	</tr>
	
</TABLE>


<?php // echo $this->loadTemplate('item'); ?>

</ul>  

<script type="text/javascript">
jQuery(function(){
	
	jQuery('#rating_1').rating({
		fx: 'full',
        image: '/templates/two_log_ru/i/services/stars.png',
        loader: '/templates/two_log_ru/i/services/ajax-loader.gif',
        width: 32,
		url: '/index.php?option=com_qcalc&task=save_rating',
		<?php if($user->guest != 0) echo "readOnly: true"; ?>
	});
	
	
	
});

function ShowFilial(obj) {
   var id = obj.options[obj.selectedIndex].value;
   if (id == 0) {
      //alert('');
	  jQuery('#filialInfo').html('');
   } else {
      var data = "pid="+id;
      jQuery.post("index.php?option=com_qcalc&task=show_filial_info&no_html=1", data, function() { }, "script");
   }
}



</script>

